#include <jni.h>
#include <string>
#include <android/bitmap.h>
#include <opencv2/opencv.hpp>
#include <iostream>
#include <android/log.h>
#include<opencv2\opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/core/types_c.h>

using namespace cv;
extern "C"
JNIEXPORT jstring JNICALL
Java_com_payne_qrcode_utils_QRCodeUtil_00024Companion_getQRCodeResult(
        JNIEnv *env, jobject thiz,
        jint rows, jint cols, jbyteArray yuvData) {
    jbyte *pNV21FrameData = env->GetByteArrayElements(yuvData, 0); //输入yuv数据
    Mat mGray(rows, cols, CV_8UC1, (unsigned char *) pNV21FrameData);


    cv::QRCodeDetector QRdetecter;
    std::vector<cv::Point> list;
    cv::Mat res;
    std::string result = QRdetecter.detectAndDecode(mGray, list, res);
    return env->NewStringUTF(result.c_str());;
}